﻿using MediatR;
using System.Security.Claims;
using T.Basic.API.Appliction.Command.FuelCostCommand;
using T.Basic.Repository.BasicImpl;
using T.Basic.Repository.BasicInterface;

namespace T.Basic.API.Appliction.CommandHandlers.FuelCostHanders
{
    /// <summary>
    /// 删除油费管理（单删）
    /// </summary>
    public class FuelCostDeleteCommandHandler:IRequestHandler<FuelCostDeleteCommand,int>
    {
        private readonly IFuelCostRepository _FuelCostrepository;
        public FuelCostDeleteCommandHandler(IFuelCostRepository fuelCostrepository)
        {
            _FuelCostrepository = fuelCostrepository;
        }

        public async Task<int> Handle(FuelCostDeleteCommand request, CancellationToken cancellationToken)
        {
            var sss = await _FuelCostrepository.GetModelsAsync(request.FuelCostId);
            sss.IsDeleted = true;
           
            return await _FuelCostrepository.UpdateAsync(sss);
        }
    }
}
